package com.yuma.observe;

public class Buyer implements Observer{
    String name;
    Saler saler;

    public Buyer(String name, Saler saler) {
        this.name = name;
        this.saler = saler;
    }

    @Override
    public void receive(String message) {
        System.out.println(name + "收到消息：" + message);
    }

    public void join(){
        saler.joinObserver(this);
    }

    public void quit(){
        saler.removeList(this);
    }
}
